<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        div{
            height: 330px;
            width: 390px;
            border: 3px solid #acfaaa;
            margin: 0 auto;
        }
        li{
            list-style: none;
            font-weight: 900;
            text-align: center;
        }
        .uul1{
            display: flex;
        }
        li{
            background: #289324;
            width: 130px;
            border: 1px solid #4411a3;
            height: 40px;
            line-height: 40px;
            user-select: none;
        }
        .uul2 p{
            font-size: 32px;
            width: 384px;
            height: 283px;
            position: absolute;
            list-style: none;
            font-weight: 900;
            text-align: center;
            display: none;
            line-height: 283px;
            font-size: 80px;
        }
        .as{
            background: #db1b0d;
            color: aliceblue;
        }
    </style>
</head>
<body>
    <div>
        <ul class="uul1">
            <li>1</li>
            <li>2</li>
            <li>3</li>
        </ul>
        <ul class="uul2">
            <p style="background-color: red;">1</p>
            <p style="background-color: yellow; color: white;">2</p>
            <p style="background-color: black; color: aqua;">3</p>
        </ul>
    </div>
</body>
</html>
<script>
    const ast = document.querySelectorAll('li')
    const sdd = document.querySelectorAll('p')
    ast.forEach(li => {
        li.onclick = () =>{
            sdd.forEach(p => {
                p.style.display = 'none'
                if(li.innerText == p.innerText){
                    p.style.display = 'block'
                    li.classList.add('as')
                }
            })
        }
    })
    
</script>
